package com.liuliu.controller.zua;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.liuliu.common.annotation.Log;
import com.liuliu.common.core.controller.BaseController;
import com.liuliu.common.core.domain.AjaxResult;
import com.liuliu.common.enums.BusinessType;
import com.liuliu.zua.domain.ZuaRecruit;
import com.liuliu.zua.service.IZuaRecruitService;
import com.liuliu.common.utils.poi.ExcelUtil;
import com.liuliu.common.core.page.TableDataInfo;

/**
 * 就业信息Controller
 * 
 * @author ruoyi
 * @date 2021-03-22
 */
@RestController
@RequestMapping("/zua/recruit")
public class ZuaRecruitController extends BaseController
{
    @Autowired
    private IZuaRecruitService zuaRecruitService;

    /**
     * 查询就业信息列表
     */
    @PreAuthorize("@ss.hasPermi('zua:recruit:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZuaRecruit zuaRecruit)
    {
        startPage();
        List<ZuaRecruit> list = zuaRecruitService.selectZuaRecruitList(zuaRecruit);
        return getDataTable(list);
    }

    /**
     * 导出就业信息列表
     */
    @PreAuthorize("@ss.hasPermi('zua:recruit:export')")
    @Log(title = "就业信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ZuaRecruit zuaRecruit)
    {
        List<ZuaRecruit> list = zuaRecruitService.selectZuaRecruitList(zuaRecruit);
        ExcelUtil<ZuaRecruit> util = new ExcelUtil<ZuaRecruit>(ZuaRecruit.class);
        return util.exportExcel(list, "recruit");
    }

    /**
     * 获取就业信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('zua:recruit:query')")
    @GetMapping(value = "/{recruitId}")
    public AjaxResult getInfo(@PathVariable("recruitId") Long recruitId)
    {
        return AjaxResult.success(zuaRecruitService.selectZuaRecruitById(recruitId));
    }

    /**
     * 新增就业信息
     */
    @PreAuthorize("@ss.hasPermi('zua:recruit:add')")
    @Log(title = "就业信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZuaRecruit zuaRecruit)
    {
        return toAjax(zuaRecruitService.insertZuaRecruit(zuaRecruit));
    }

    /**
     * 修改就业信息
     */
    @PreAuthorize("@ss.hasPermi('zua:recruit:edit')")
    @Log(title = "就业信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZuaRecruit zuaRecruit)
    {
        return toAjax(zuaRecruitService.updateZuaRecruit(zuaRecruit));
    }

    /**
     * 删除就业信息
     */
    @PreAuthorize("@ss.hasPermi('zua:recruit:remove')")
    @Log(title = "就业信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{recruitIds}")
    public AjaxResult remove(@PathVariable Long[] recruitIds)
    {
        return toAjax(zuaRecruitService.deleteZuaRecruitByIds(recruitIds));
    }
}
